package cn.netjava.softkid.chapter11;


import java.net.Socket;


public class ScannerThread extends Thread
{
	private int from;
	private int to;
	private String ip;
	
	public ScannerThread(int from,int to,String ip)
	{
		this.from=from;
		this.to=to;
		this.ip=ip;
	}
	public void run()
	{
		scanner(from,to,ip);
	}
	public void scanner(int from,int to,String ip)
	{
		for(int i=from;i<to;i++)
		{
			try {
				new Socket(ip,i);
				System.out.println("opened:"+i);
				PortScanner.area.append("opened:"+i+"\n");
			} catch (Exception e) {
//				System.out.println("closed:"+i);
			} 
		}
	}
}
